<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登陆</title>
</head>
<body>
		<form action="xx.do" method="post">
		用户名:<input type="text" name="username" value="liu"/> 
		密码：<input type="password" name="password" value="hao"/> 
		<input type="button" id="btn01" value="注册"/>
	</form>

</body>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.4.4.js"></script>
<script>
	$(function(){
		$('#btn01').click(function(){
			var username=$('input[name="username"]').val();
			var password=$('input[name="password"]').val();
			
			var url="${pageContext.request.contextPath}/lo";
			
			var data={
				'username':username,
				'password':password,		
			};
			
			 $.ajax({
				 type:'post',
				 url:'${pageContext.request.contextPath}/lo',
				 data:'name=John&location=Boston',
				 success: function(msg){
					 console.log( "Data Saved: " + msg );
				   }

			 });
			
			
			/* $.post(url,data,function(data){
				console.log(data);
			},'json'); */
			
		});
	});

</script>
</html>